# -*- coding: utf-8 -*-
'''
@author: lowzoom
'''
import ctypes
from ctypes.wintypes import MAX_PATH
import win32con
import win32gui

# 我的文档
CSIDL_PERSONAL = 0x0005

# System32
CSIDL_SYSTEM = 0x0025

def get_system32():
	return get_folder(CSIDL_SYSTEM)

def get_my_documents():
	return get_folder(CSIDL_PERSONAL)

def get_folder(csid):
	'''
	返回指定特殊文件夹的路径
	@param csid: 特殊文件夹ID
	'''
	_buf = ctypes.create_unicode_buffer(MAX_PATH + 1)
	ctypes.windll.shell32.SHGetSpecialFolderPathW(None, _buf, csid, False)
	return _buf.value

def activate_window(hwnd):
	# 将窗口从最小化还原
	win32gui.ShowWindow(hwnd, win32con.SW_RESTORE)
	# 将窗口上升到最前端
	win32gui.SetForegroundWindow(hwnd)
	# 刷新窗口内容
	win32gui.RedrawWindow(hwnd, None, None, win32con.RDW_INVALIDATE)

if __name__ == "__main__":
	print(get_system32())
